package ATBMS.modles;

/**
 * User Modle
 */
public class User {

    /**
     * User Level
     */
    public final static int USERLEVEL_USER = 1;
    public final static int USERLEVEL_MANAGER = 2;
    public final static int USERLEVEL_ADMIN = 3;
    private Integer uid;
    private String uname;
    private Integer uflag;
    private String uaddr;
    private String utel;
    private String uemail;
    private String password;
    private String password2;

    public User(String uname, Integer uflag, String uaddr, String utel, String uemail, String password, String password2) {
        this.uname = uname;
        this.uflag = uflag;
        this.uaddr = uaddr;
        this.utel = utel;
        this.uemail = uemail;
        this.password = password;
        this.password2 = password2;
    }

    /**
     * Create a User Object
     */
    public User() {
    }

    /**
     * Create a User Object
     * @param uid
     */
    public User(Integer uid) {
        this.uid = uid;
    }

    /**
     * Create a User Object
     * @param uname
     * @param password
     */
    public User(String uname, String password) {
        this.uname = uname;
        this.password = password;
    }

    /**
     * Create a User Object
     * @param uname
     * @param uflag
     * @param uaddr
     * @param utel
     * @param uemail
     * @param password
     */
    public User(String uname, Integer uflag, String uaddr, String utel, String uemail, String password) {
        this.uname = uname;
        this.uflag = uflag;
        this.uaddr = uaddr;
        this.utel = utel;
        this.uemail = uemail;
        this.password = password;
    }

    /**
     * Create a User Object
     * @param uid
     * @param uflag
     * @param uname
     * @param uaddr
     * @param utel
     * @param uemail
     */
    public User(Integer uid, int uflag, String uname, String uaddr, String utel, String uemail) {
        this.uid = uid;
        this.uflag = uflag;
        this.uname = uname;
        this.uaddr = uaddr;
        this.utel = utel;
        this.uemail = uemail;
    }

    /**
     * Create a User Object
     * @param uflag
     * @param uname
     * @param password
     */
    public User(int uflag, String uname, String password) {
        this.uflag = uflag;
        this.uname = uname;
        this.password = password;
    }

    public String getPassword2() {
        return password2;
    }

    public void setPassword2(String password2) {
        this.password2 = password2;
    }

    /**
     * Get User Password
     * @return password
     */
    public String getPassword() {
        return password;
    }

    /**
     * Set Password
     * @param password
     */
    public void setPassword(String password) {
        this.password = password;
    }

    /**
     * Get User ID
     * @return user id
     */
    public Integer getUid() {
        return uid;
    }

    /**
     * Set User ID
     * @param user id
     */
    public void setUid(Integer uid) {
        this.uid = uid;
    }

    /**
     * Get User Name
     * @return User Name
     */
    public String getUname() {
        return uname;
    }

    /**
     * Set User Name
     * @param uname
     */
    public void setUname(String uname) {
        this.uname = uname;
    }

    /**
     * Get User Level
     * @return User Level
     */
    public Integer getUflag() {
        return uflag;
    }

    /**
     * Get User Level String
     * @return User Level String
     */
    public String getUlevel() {
        switch (uflag) {
            case USERLEVEL_USER:
                return "User";
            case USERLEVEL_MANAGER:
                return "Manager";
            case USERLEVEL_ADMIN:
                return "Administrator";
        }
        return "Unknow";
    }

    /**
     * Set User Level
     * @param uflag
     */
    public void setUflag(Integer uflag) {
        this.uflag = uflag;
    }

    /**
     * Get  Address
     * @return address
     */
    public String getUaddr() {
        return uaddr;
    }

    /**
     * Set Address
     * @param uaddr
     */
    public void setUaddr(String uaddr) {
        this.uaddr = uaddr;
    }

    /**
     * Get Telephone Number
     * @return telphone
     */
    public String getUtel() {
        return utel;
    }

    /**
     * Set Telephone Number
     * @param utel
     */
    public void setUtel(String utel) {
        this.utel = utel;
    }

    /**
     * Get EMail
     * @return
     */
    public String getUemail() {
        return uemail;
    }

    /**
     * Set EMail
     * @param uemail
     */
    public void setUemail(String uemail) {
        this.uemail = uemail;
    }
}
